//
//  ViewController.m
//  YLTool
//
//  Created by EmberWei on 2018/7/30.
//  Copyright © 2018年 EmberWei. All rights reserved.
//

#import "ViewController.h"
#import "YLTool.h"
#import <UIView+Toast.h>
#import "Model.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (IBAction)onPress:(id)sender {
    [YLTool POST:@"/authentication/form" params:@{@"password":@"sunny",@"username":@"user"} success:^(NSDictionary * _Nonnull JSON) {
        ResponseLogin *login = (ResponseLogin*)[ResponseLogin toModel:JSON];
        [self.view makeToast:login.data.access_token];
    } failure:^(NSString * _Nonnull error) {
        [self.view makeToast:error];
    }];
}

@end
